D:\git\skunkworks\herald-for-cpp\herald-tests\extendeddata-tests.cpp
Line | Count | Source |
1 | | // Copyright 2020-2021 Herald Project Contributors |
2 | | // SPDX-License-Identifier: Apache-2.0 |
3 | | // |
4 | | |
5 | | #include <memory> |
6 | | #include <array> |
7 | | #include <deque> |
8 | | #include <forward_list> |
9 | | #include <list> |
10 | | #include <map> |
11 | | #include <queue> |
12 | | #include <set> |
13 | | #include <stack> |
14 | | #include <unordered_map> |
15 | | #include <unordered_set> |
16 | | #include <vector> |
17 | | |
18 | | #include "catch.hpp" |
19 | | |
20 | | #include "herald/herald.h" |
21 | | |
22 | | |
23 | 1 | TEST_CASE("payload-extendeddata-empty", "[payload][extendeddata][empty]") { |
24 | 1 | SECTION("payload-extendeddata-empty") { |
25 | 1 | herald::payload::extended::ConcreteExtendedDataV1 d; |
26 | 1 | auto pd = d.payload(); |
27 | 1 | |
28 | 1 | REQUIRE(pd.size() == 0); // no data unless sections exist! |
29 | 1 | } |
30 | 1 | } |
31 | | |
32 | 1 | TEST_CASE("payload-extendeddata-one-section", "[payload][extendeddata][one-section]") { |
33 | 1 | SECTION("payload-extendeddata-one-section") { |
34 | 1 | herald::payload::extended::ConcreteExtendedDataV1 d; |
35 | 1 | d.addSection(herald::payload::extended::ExtendedDataSegmentCodesV1::TextPremises,std::string("Adams Pizza")); |
36 | 1 | auto pd = d.payload(); |
37 | 1 | |
38 | 1 | REQUIRE(pd.size() == 13); // 1 code + 1 length + 11 characters |
39 | 1 | } |
40 | 1 | } |